use std::fmt ;


#[derive(Debug)]
pub struct JsonRepairError {
    pub message: String,
    pub position: usize,
}


impl JsonRepairError {
    pub fn new(message: &str, position: usize) -> Self {
        JsonRepairError {
            message: message.to_string(),
            position,
        }
    }
}

impl fmt::Display for JsonRepairError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{} at position {} ", self.message, self.position)
    }


}

impl std::error::Error for JsonRepairError {}
pub fn json_repair_error(message: &str, position: usize) -> JsonRepairError {
    JsonRepairError {
        message: message.to_string(),
        position,
    }
}